<?php
    $unit = $this->unit;
    $priceBands = $this->priceBands;
    $bandsCount = count($priceBands);
    $prices = $this->prices;
    $config = new RM_Config();
    $currencySymbol = $config->getValue('rm_config_currency_symbol');
    $dateFormat = $config->getJSDateformat();
    $showDates = $this->showDates;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr" id="RM_price_module_pricelist_page" >
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <link rel="stylesheet" type="text/css" href="<?php echo RM_Environment::getConnector()->getRootURL(); ?>RM/userdata/css/user.css"/>
        <link rel="stylesheet" type="text/css" href="<?php echo RM_Environment::getConnector()->getRootURL(); ?>RM/userdata/css/user_overrides.css"/>
        <div class="RM_price_module_pricelist_container">
            <div class="RM_price_module_pricelist_header_container">
                <div class="RM_price_module_pricelist_header">
                    <?php echo $unit->name."&nbsp;".$this->_translate->_('User.Unit.Prices','Title');?>
                </div>
            </div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="RM_divTable">

            <tr class="RM_divHeaderRow">
                <?php if ($showDates === "1"){?>
                <td class="RM_divHead"><?php echo $this->_translate->_('User.Unit.List','StartDate');?></td>
                <td class="RM_divHead"><?php echo $this->_translate->_('User.Unit.List','EndDate');?></td>
                <?php } ?>
                <?php foreach($priceBands as $col) { ?>
                <td class="RM_divHead"><?php echo $col->name; ?></td>
                <?php } ?>
            </tr>
            <?php foreach($prices as $row) { ?>
            <tr>
                <?php if ($showDates === "1"){?>
                <td class="RM_divHead"><?php echo date($dateFormat, strtotime($row['start_datetime'])); ?></td>
                <td class="RM_divHead"><?php echo date($dateFormat, strtotime($row['end_datetime'])); ?></td>
                <?php } ?>
                <?php 
                    foreach($row as $key=>$value) {
                        if (strpos($key, 'band_')===0) {
                ?>
                <td class="RM_divHead"><?php echo $currencySymbol.$value; ?></td>
                <?php  
                        }
                    }
                ?>
            </tr>
            <?php } ?>
            </table>
        </div>
    </body>
</html>